package com.zhonghui.license;

import java.io.IOException;
import java.io.FileNotFoundException;
import java.io.FileInputStream;
import java.io.File;
import java.io.InputStream;
import de.schlichtherle.license.AbstractKeyStoreParam;

public class CustomKeyStoreParam extends AbstractKeyStoreParam
{
    private String storePath;
    private String alias;
    private String storePwd;
    private String keyPwd;
    
    public CustomKeyStoreParam(final Class clazz, final String resource, final String alias, final String storePwd, final String keyPwd) {
        super(clazz, resource);
        this.storePath = resource;
        this.alias = alias;
        this.storePwd = storePwd;
        this.keyPwd = keyPwd;
    }
    
    public String getAlias() {
        return this.alias;
    }
    
    public String getStorePwd() {
        return this.storePwd;
    }
    
    public String getKeyPwd() {
        return this.keyPwd;
    }
    
    public InputStream getStream() throws IOException {
        final InputStream in = new FileInputStream(new File(this.storePath));
        if (null == in) {
            throw new FileNotFoundException(this.storePath);
        }
        return in;
    }
}
